//
//  HomeService.swift
//  MagoT
//
//  Created by mac on 2023/12/23.
//

import Foundation
import Moya

enum HomeService {
    case banner
    case topArticle
}

extension HomeService: TargetType {
    var baseURL: URL {
        return URL(string: Api.baseUrl)!
    }
    
    var path: String {
        switch self {
        case .banner:
            return Api.Home.banner
        case .topArticle:
            return Api.Home.topArticle
            
        }
    }
    
    var method: Moya.Method {
        switch self {
        case .banner,
            .topArticle:
            return .get
        default:
            return .post
        }
    }
    
    var sampleData: Data {
        switch self {
        case .banner,
            .topArticle:
            return Data()
        default:
            return Data()
        }
    }
    
    var task: Moya.Task {
        switch self {
        case .banner,
            .topArticle:
            return .requestParameters(parameters: .empty, encoding: URLEncoding.default)
        default:
            return .requestParameters(parameters: .empty, encoding: URLEncoding.default)
        }
    }
    
    var headers: [String : String]? {
        nil
    }
    
    
}
